package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.dao.RoleDao;
import com.itheima.entity.Result;
import com.itheima.pojo.Role;
import com.itheima.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(interfaceClass = RoleService.class)
@Transactional
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDao roleDao;
    @Override
    public Result findAll() {
        try {
            List<Role> roleList = roleDao.findAll();
            return new Result(true,"获取角色信息成功",roleList);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"获取角色信息失败");
        }
    }

}
